package jicheng;
public class Pet {
    private int health;
     private int love;
     private String name;
     public int getHealth() {
                return health;
     }
   public void setHealth(int health) {
                 if(health>100 || health<0) {
                       System.out.println("健康值度有误，修改默认值");
                        health = 60;
                    }
               this.health = health;
            }
     public int getLove() {
         return love;
            }
   public void setLove(int love) {
               if(love>100 || love<0) {
                      System.out.println("亲密度有误，修改默认值");
                       love = 60;
               }
                this.love = love;
          }
   public String getName() {
               return name;
           }
    public void setName(String name) {
               this.name = name;
            }
   public void print() {
              System.out.println("宠物的自白");
               System.out.print("我的名字叫："+getName()+"健康值是："+getHealth()+"和主人的亲密度是："+getLove());
            }
 }


